package com.yycwxt.modules.admin.cgj_xscb_gdpdk.gdpdk;

import com.yycwxt.modules.admin.data_import.ImpFile;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by Mr.Zhang on 2022/9/17 14:59
 */
@Mapper
public interface ImpGdpdkMapper {

    @Select("""
            select b.id, a.value name, b.filename, b.zq, b.url, b.remark, b.created
            from (select distinct value from sys_dictionary where name='文件清单') a
            left outer join imp_files b on a.value = b.name and b.zq = #{zq}
            """)
    public List<ImpFile> selectImpFiles(@Param("zq") Integer zq);

    // 调用销售成本明细存储过程
    @Select("""
            call impGdpdk(
                #{zq,mode=IN,jdbcType=INTEGER},
                #{dp,mode=IN,jdbcType=VARCHAR},
                #{htdk,mode=IN,jdbcType=DECIMAL},
                #{wxdk,mode=IN,jdbcType=DECIMAL},
                #{sr,mode=IN,jdbcType=DECIMAL},
                #{hz,mode=IN,jdbcType=DECIMAL}
                );
            """)
    public void impGdpdk(Integer zq, String dp, BigDecimal htdk, BigDecimal wxdk, BigDecimal sr, BigDecimal hz);
}
